package org.zhou.dao;

import org.springframework.stereotype.Repository;
import org.zhou.pojo.Department;

import java.security.PrivateKey;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

//部门dao
@Repository
public class DepartmentDao {
//    初始化数据 模拟数据库中的数据
    private static Map<Integer, Department> departmentMap=null;

    static {
    departmentMap=new HashMap<Integer,Department>();//创建一个部门表
        departmentMap.put(101,new Department(101,"教学部"));
        departmentMap.put(102,new Department(102,"市场部"));
        departmentMap.put(103,new Department(103,"教研部"));
        departmentMap.put(104,new Department(104,"运营部"));
        departmentMap.put(105,new Department(105,"后勤部"));

}
//    获得所有部门信息
    public Collection<Department> getDepartment(){
        return departmentMap.values();
    }

//    通过id获得部门
    public Department getDepartmentById(Integer id){
        return  departmentMap.get(id);
    }





}
